//
//  HptDetailsCell.m
//  wedding
//
//  Created by 常宽 on 15/1/22.
//  Copyright (c) 2015年 常宽. All rights reserved.
//

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height

#import "HptDetailsCell.h"

@interface HptDetailsCell ()

/// 标题
@property (nonatomic, retain) UITextView *textView;
/// 日期
@property (nonatomic, retain) UILabel *dateView;

@end

@implementation HptDetailsCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.picView = [[UIImageView alloc] init];
        [self.contentView addSubview:_picView];
        
        self.textView = [[UITextView alloc] init];
        [self.contentView addSubview:_textView];
        
        self.dateView = [[UILabel alloc] init];
        [self.contentView addSubview:_dateView];
        
    }
    return self;
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    /// 图片, 自适应
    UIImage *aImage = _picView.image;
    
    CGFloat offW = aImage.size.width / WIDTH;
    CGFloat offH = 1;
    if (aImage != nil) {
        offH = aImage.size.height / offW;
    }
    _picView.frame = CGRectMake(2.5, 0, WIDTH, offH);
    _picView.clipsToBounds = YES;
    _picView.contentMode = UIViewContentModeScaleAspectFill;
    
//    /// 标题
//    self.textView.frame = CGRectMake(<#CGFloat x#>, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>);
//    
//    /// 日期
//    self.dateView.frame = CGRectMake(<#CGFloat x#>, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>);
    

}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
